package com.hejia.alauda.exception;

public enum BusinessExceptionCode {
	EXCEPTION_1000(1000, "未知错误"),
	
	EXCEPTION_1001(1001, "请输入11位手机号码"),
	EXCEPTION_1002(1002, "请输入正确的11位手机号码"),
	EXCEPTION_1003(1003, "请输入手机号码"),
	EXCEPTION_1004(1004, "该号码已经被注册"),
	EXCEPTION_1005(1005, "该手机号码还未注册"),
	
	EXCEPTION_1010(1010, "请输入6～16位长度的密码"),
	EXCEPTION_1011(1011, "请输登录密码"),
	EXCEPTION_1012(1012, "请输新登录密码"),
	EXCEPTION_1013(1013, "新密码不能与当前密码相同"),
	EXCEPTION_1014(1014, "手机号或者密码不正确"),
	EXCEPTION_1015(1015, "请输入手机号和密码"),
	EXCEPTION_1016(1016, "当前密码错误"),
	EXCEPTION_1017(1017, "openid不能为空"),
	EXCEPTION_1018(1018, "账户不存在，请前往注册页面注册"),

	EXCEPTION_1021(1021, "请输入验证码"),
	EXCEPTION_1022(1022, "验证码错误，请重新输入"),
	EXCEPTION_1023(1023, "验证码超时，请重新获取"),
	EXCEPTION_1024(1024, "请输入校验码"),
	EXCEPTION_1025(1025, "校验码错误，请重新输入"),
	EXCEPTION_1026(1026, "验证码超时，请重新获取"),

	EXCEPTION_1030(1030, "该银行卡已存在"),
	EXCEPTION_1031(1031, "请输入真实姓名"),
	EXCEPTION_1032(1032, "真实姓名与账户姓名不符"),
	EXCEPTION_1033(1033, "身份证与账户身份证不符"),
	EXCEPTION_1034(1034, "不支持该银行卡"),
	EXCEPTION_1035(1035, "请输入身份证号"),
	EXCEPTION_1036(1036, "银行卡不存在"),
	EXCEPTION_1037(1037, "身份证号未年满18周岁"),
	
	EXCEPTION_1040(1040, "该订单已过期"),
	EXCEPTION_1041(1041, "该订单已付款"),
	EXCEPTION_1042(1042, "请输入姓名、身份证号和银行卡号。"),
	EXCEPTION_1043(1043, "一个身份证号只能绑定一个手机账号"),
	EXCEPTION_1044(1044, "请输入银行卡号"),
	EXCEPTION_1045(1045, "订单不存在"),
	
	EXCEPTION_1057(1057, "产品剩余份额不足"),
	EXCEPTION_1058(1058, "该产品单笔最低购买金额为{0}元"),
	EXCEPTION_1059(1059, "该产品单笔最高购买金额为{0}元"),
	EXCEPTION_1060(1060, "身份证号错误，请重新输入"),
	EXCEPTION_1061(1061, "银行卡号错误，请重新输入"),
	EXCEPTION_1062(1062, "购买金额必须为{0}的整数倍"),
	EXCEPTION_1063(1063, "剩余份额不足，您最多还可以购买{0}元"),
	EXCEPTION_1064(1064, "订单金额不合法"),
	EXCEPTION_1065(1065, "有用户下单暂未付款，您多刷新页面，还会有机会购买到此产品。"),
	EXCEPTION_1066(1066, "卖完了。"),
	EXCEPTION_1067(1067, "银行卡不能为空"),
	EXCEPTION_1068(1068, "产品不存在"),
	EXCEPTION_1069(1069, "请重新登录"),
	

	EXCEPTION_1070(1070, "没有版本信息"),
	EXCEPTION_1071(1071, "协议不存在"),
	EXCEPTION_1072(1072, "产品不能购买"),
	

	EXCEPTION_2000(2000, "系统错误。"),
	EXCEPTION_2001(2001, "系统错误，注册失败。"),
	EXCEPTION_2002(2002, "系统错误，修改密码失败。"),
	EXCEPTION_2003(2003, "系统错误，生成订单失败。"),
	EXCEPTION_2004(2004, "非法的订单。"),
	EXCEPTION_2020(2020, "网关错误。"),
	
	EXCEPTION_10001(10001,"该用户未进行过关联"),
	EXCEPTION_10002(10002,"该用户已经进行过关联"),
	
	
	EXCEPTION_21000(21000, "session失效，请重新登录"),
	EXCEPTION_21001(21001, "短信发送过于频繁，请30秒后再试"),
	EXCEPTION_21002(21002, "51信用卡用户user_id为空"),
	EXCEPTION_21003(21003, "活动已结束"),
	EXCEPTION_21004(21004, "亲爱的合家用户，非常抱歉，由于您不是华数专享用户，暂时无法购买专享渠道产品，敬请谅解。"),
	EXCEPTION_21005(21005, "非法获取消息。");
	
	private int code;
	private String description;
	
	private BusinessExceptionCode(int code, String description) {
		setCode(code);
		setDescription(description);
	}
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	public static BusinessExceptionCode getBusinessExceptionCodeFromCode(Integer code) {
		BusinessExceptionCode alaudaExceptionCode = null;
		if(code == null)
			code = 1000;
		for(BusinessExceptionCode item : BusinessExceptionCode.values()){
			if(item.getCode() == code.intValue()){
				alaudaExceptionCode = item;
				break;
			}
		}
		if(alaudaExceptionCode==null)
			alaudaExceptionCode = EXCEPTION_1000;
		return alaudaExceptionCode;
	}
}
